package seven.test_7_18;

import java.util.Scanner;

public class TestMain1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int app1 = a * 2;
        int app2 = b;
        int peach1 = a;
        int peach2 = b * 2;
        int count = 0;
        if(a > 2 * b) {
            while (n >= 2 && m >= 1) {
                n -= 2;
                m -= 1;
                count += a;
            }
            while (n >= 1 && m >= 2) {
                n -= 1;
                m -= 2;
                count += b;
            }
        } else if (2 * a < b){
            while (n >= 1 && m >= 2) {
                n -= 1;
                m -= 2;
                count += b;
            }
            while (n >= 2 && m >= 1) {
                n -= 2;
                m -= 1;
                count += a;
            }
        } else {
            if(app1 * n + peach1 * m > app2 * n + peach2 * m) {
                while (n >= 2 && m >= 1) {
                    n -= 2;
                    m -= 1;
                    count += a;
                }
                while (n >= 1 && m >= 2) {
                    n -= 1;
                    m -= 2;
                    count += b;
                }
            } else if(app1 * n + peach1 * m < app2 * n + peach2 * m) {
                while (n >= 1 && m >= 2) {
                    n -= 1;
                    m -= 2;
                    count += b;
                }
                while (n >= 2 && m >= 1) {
                    n -= 2;
                    m -= 1;
                    count += a;
                }
            } else {
                if(n > m) {
                    while (n >= 2 && m >= 1) {
                        n -= 2;
                        m -= 1;
                        count += a;
                    }
                    while (n >= 1 && m >= 2) {
                        n -= 1;
                        m -= 2;
                        count += b;
                    }
                } else {
                    while (n >= 1 && m >= 2) {
                        n -= 1;
                        m -= 2;
                        count += b;
                    }
                    while (n >= 2 && m >= 1) {
                        n -= 2;
                        m -= 1;
                        count += a;
                    }
                }
            }
        }
        System.out.println(count);
    }
}
